<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>报价解密查看</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

     ${projId==null?"":"<!--" } <section class="content-header">
        <h1>报价解密查看</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">药品招标管理</a></li>
            <li class="active"><a href="#">评标管理</a></li>
           <li class="active"><a href="#">报价解密查看</a></li>
        </ol>
    </section>
    <section class="content">
        <form id="form" method="post" class="form-horizontal">
        <div class=" box box-success">
            <div class="box-body">
                <div class="input">
                    <div class="textalign1">项目名称：</div>
                    <div class="boxinput">
                        <select class="textinput" id="projId" name="projId"></select>
                    </div>                  
                    <div class="textalign">类型：</div>
                    <div class="boxinput">
                        <select class="textinput" id="projCat" name="projCat">
                        	<option value="">请选择</option>
                        	<option value="1">招标采购</option>
                        	<option value="2">谈判采购</option>
                        	<option value="3">定点生产</option>
                        	<option value="4">直接采购</option>
                        </select>
                    </div>
                     <div class="textalign">药品编码：</div>
                    <div class="boxinput">
                        <input class="textinput" id="drugCode" placeholder="药品编码" />
                    </div>
                </div>
                <div class="input">
                    <div class="textalign1">通用名：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="qualityspecName" placeholder="通用名"/>
                    </div>
                    <div class="textalign">企业编码：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compCode" placeholder="企业编码"/>
                    </div>
                    <div class="textalign">企业名：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compName" placeholder="企业名"/>
                    </div>
                </div>
                <div class="input">
                    <div class="textalign1">类型：</div>
                    <div class="boxinput">
                        <select class="textinput"  id="decryptStatus" name="decryptStatus">
                        	<option value="">请选择</option>
                        	<option value="0">未报价</option>
                        	<option value="2">已解密</option>
                        	<option value="1">未解密</option>
                        </select>
                    </div>
                    <div class="textalign" >
                        <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm">查&nbsp;询</button>
                    </div> 
                </div>
            
                <!--<div class=" form-inline">               
                	<div class="form-group form-group-xs">
                	    <label for="txtDrugName">项目名称：</label>
					    <select class="form-control" style="width:220px;" id="projId" name="projId"></select>
                	</div>
                	<div class="form-group form-group-xs">
                        <label for="txtDrugForm">类型：</label>
                        <select class="form-control"  id="projCat" name="projCat">
                        	<option value="">请选择</option>
                        	<option value="1">招标采购</option>
                        	<option value="2">谈判采购</option>
                        	<option value="3">定点生产</option>
                        	<option value="4">直接采购</option>
                        </select>
                    </div>
                	<%-- <div class="form-group form-group-xs">
                	    <label for="txtDrugName">项目类型：</label>
					    <select class="form-control" style="width:220px;" id="projCat" name="projCat">
					    <option value="">请选择</option>
					    <c:choose>
					    	<c:when test="${!empty projCatList }">
					    		<c:forEach items="${projCatList }" var="projCatList">
					    			<option value="${projCatList.dicCode }">${projCatList.dicName}</option>
					    		</c:forEach>
					    	</c:when>
					    </c:choose>
					    </select>
                	</div> --%>
                	<div class="form-group form-group-xs">
                    	<label>药品编号：</label>
                        <input class="form-control" type="text" id="drugCode" placeholder="药品编码" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label>通用名：</label>
                        <input class="form-control" type="text" id="qualityspecName" placeholder="通用名" />
                    </div>
                    <div class="form-group form-group-xs">
                    	<label>企业编号：</label>
                        <input class="form-control" type="text" id="compCode" placeholder="企业编码" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label>企业名称：</label>
                        <input class="form-control" type="text" id="compName" placeholder="企业名称" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">类型：</label>
                        <select class="form-control"  id="decryptStatus" name="decryptStatus">
                        	<option value="">请选择</option>
                        	<option value="0">未报价</option>
                        	<option value="2">已解密</option>
                        	<option value="1">未解密</option>
                        </select>
                    </div>
                     
                    <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm"> 查&nbsp;询</button>
                </div>-->
            </div>
          </div>
        </form>  
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>

    </section>${projId==null?"":" -->" }
    <%@ include file="/WEB-INF/component/commonJS.jsp" %> 
    <script type="text/javascript">
    if("${projId}"){
    	$(function(){
    		$.HN.dialog.open({
                id:"realTime",
                title:'${projMap.projName}/总药品数:${projMap.drugCount}',
                url:"${ctx}/bidScoreRule/toRealTimeSeeList.html?projId=${projId}",
                width:"1100px",
                height:"500px"
            });
    	})
    	
    }else{
    	 $(function(){
    	    	
    			$("#projId").HNSelect({
    	            url: "${pageContext.request.contextPath}/selectController/getDicBidCompany.html", data: { ID: '' }, defaultText: "<option value=''>请选择</option>",
    	        });
    		});
    	    
    	    
    	        
    	        $(function () {
    	            $("#gridlist").jqGrid({
    	                url: "${ctx}/bidScoreRule/getViewProjDrugList.html",
    	                mtype: "POST",
    	                datatype: "json",
    	                autowidth: true,
    	                shrinkToFit:false,
    	                height: 270,
    	                colNames: [ '操作','项目ID','项目药品ID','bidProjdrugsScoreId', '项目名称', '项目类型','药品编码','通用名','剂型','规格','转换系数','单位','材质','企业编码','企业名称','解密状态','解密价格','解密时间'],
    	                colModel: [
    	                    { name: 'operate', width: 100 , align:"center" ,sortable: false, 
    						    formatter : function(val, opts, rowdata) {
    						        var str = "";
    						        	str +="<a href='javascript:openDialog(\""+rowdata.projId+"\")' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -180px -20px' class='opIcon' title='实时查看'></a>";
    						        return str;
    						    }
    						},
    	                    { name: 'projId', width: 60,hidden:true , align:"center" ,sortable: false},
    	                    { name: 'projProddrugId', width: 80,hidden:true , align:"center" ,sortable: false},
    	                    { name: 'bidProjdrugsScoreId', width: 120 ,hidden:true, align:"center",sortable: false},
    	                    
    	                    { name: 'name', width: 220 , align:"center" ,sortable: false},
    	                    { name: 'projCat', width: 100 , align:"center" ,sortable: false},
    	                    { name: 'drugCode', width: 120 , align:"center" ,sortable: false},
    	                    { name: 'qualityspecName', width: 160 , align:"center" ,sortable: false},
    	                    { name: 'formName', width: 120 , align:"center" ,sortable: false},
    	                    { name: 'specName', width: 80 , align:"center" ,sortable: false},
    	                    { name: 'factor', width: 60 , align:"center" ,sortable: false},
    	                    { name: 'unit', width: 60 , align:"center" ,sortable: false},
    	                    { name: 'materialName', width: 60 , align:"center" ,sortable: false},
    	                    { name: 'compCode', width: 120 , align:"center" ,sortable: false},
    	                    { name: 'compName', width: 190 , align:"center" ,sortable: false,
    	                    	formatter:function(cellvalue, options, row){ 
    	                    		return "<a href=\"javascript:$.HN.dialog.opendialog('"+cellvalue+"','企业详情','${ctx}/stdCompinfo/toStdCompinfoDetailJsp.html?compCodeDetail="+row.compCode+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>"
    	                    }},
    	                    { name: 'decryptStatus', width: 80,hidden:true , align:"center" ,sortable: false,
    							formatter : function(val, opts,rowdata) {
    								var str="";
    								if (val == 0) {
    									return "未申报";
    								}else if (val == 1) {
    									return str="未解密";
    								}else if (val == 2) {
    									return str="已解密";
    								}
    								return str;
    					} },
    	                    { name: 'decryptPrice', width: 80 , align:"right" ,sortable: false},
    	                    { name: 'decryptDatetime', width: 80 , align:"center" ,sortable: false}
    	                ],
    	                rowNum: 20,
    	                rowList: [10,20,50,100],
    	                rownumbers: true,
    	                pager: "#gridpage",
    	                viewrecords: true,
    	                caption: "报价解密列表",
    	                jsonReader: {
    	                    repeatitems: false,
    	                    id: "projId"
    	                },
    	                gridComplete: function(){
    	                	var page = $("#gridlist").jqGrid('getGridParam','page');
    	            		var rows = $('#gridlist').getGridParam("rowNum");
    	            		var maxnum = (rows*page).toString();
    	            		var len = (maxnum.length)*10;
    	            		$('.jqgfirstrow').find('td').eq(0).css('width',len+'px');
    	                	$('#gridlist_rn').css('width',len+'px');
    	                }
    	            });
    	            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
    	            $(window).trigger("resize");  
    	        });
    	        

    	        //查询
    	        function gridSerch() {
    	            var projId = $("#projId").val();
    	            var projCat = $("#projCat").val();
    	            var drugCode = $("#drugCode").val();
    	            var qualityspecName = $("#qualityspecName").val();
    	            var compCode = $("#compCode").val();
    	            var compName = $("#compName").val();
    	            var decryptStatus = $("#decryptStatus").val();
    	            $("#gridlist").jqGrid('setGridParam',{  
    	                datatype:'json',
    	                postData:{
    	                		"projId":projId,
    	                		"projCat":projCat,
    	                		"drugCode":drugCode,
    	                		"qualityspecName":qualityspecName,
    	                		"compCode":compCode,
    	                        "compName":compName,
    	                        "decryptStatus":decryptStatus}
    	            }).trigger("reloadGrid"); //重新载入  
    	        }
    	        
    	        function openDialog(projId){
    	        	 $.post("${ctx}/bidScoreRule/getProjectData.html", {
    	                 "projId" :projId
    	             }, function(result) {
    	                 if (result.success) {
    	                	 $.HN.dialog.open({
    	    	                   id:"realTime",
    	    	                   title:result.rows.projName+'/总药品数:'+result.rows.drugCount,
    	    	                   url:" ${ctx}/bidScoreRule/toRealTimeSeeList.html?projId="+projId,
    	    	                   //data:{"projId":projId},
    	    	                   width:"1100px",
    	    	                   height:"500px"
    	    	               });
    	                 } else {
    	                     $.alert(result.msg||"数据异常",  "error");
    	                 }
    	             }, "json")
    	         	 
    	           }
    }
   
        
        
     
	   
 
    </script>
</body>
</html>